$(function() {
	var aaaa;
	
	load_right1();
	load_right2();
	load_right3();
	load_right4();
	middle1();
	load_middle2();
	bottomleft();
	load_left1();
	
	setInterval(function (){
		load_right1();
	 }, 5000);
	setInterval(function (){
		load_right2();
	 }, 5000);
	setInterval(function (){
		load_right3();
	 }, 5000);
	setInterval(function (){
		load_right4();
	 }, 5500);
	setInterval(function (){
		load_middle2();
	 }, 6000);	
	
	function middle1(){
		var myChart = echarts.init(document.getElementById('middle1'));
		$.getJSON('js/gl.json', function(data) {
			
	    function getAirportCoord(idx) {
	        return [data.airports[idx][3], data.airports[idx][4]];
	    }
	    var routes = data.routes.map(function(airline) {
	        return [
	            getAirportCoord(airline[1]),
	            getAirportCoord(airline[2])
	        ];
	    });

	    myChart.setOption({
	        globe: {
	          	baseTexture: "img/200401.jpg",
	            displacementScale: 0.04,
	            shading: 'realistic',
	             realisticMaterial: {
	            roughness: 0.9
	                 },
	           postEffect: {
	               enable: true
	              },
	            light: {
	                ambient: {
	                    intensity: 2
	                },
	                main: {
	                    intensity: 2,
	                    shadow: true
	                }
	            },

	           ambientCubemap: {
	                //texture: 'data-gl/asset/pisa.hdr',
	                diffuseIntensity: 10
	            }
	        },
	        series: {

	            type: 'lines3D',

	            coordinateSystem: 'globe',

	            blendMode: 'lighter',

	            lineStyle: {
	                width: 2,
	               color: 'rgb(50, 50, 150)',
//					color:'yellow',
	                opacity: 0.1
	            },

	            data: routes
	        }
	    });
	});
		}

	function load_left1(){
		$.ajax({
			type : 'post',	//传输类型	
			async : false,	//同步执行
			url : 'ditu.do',	//web.xml中注册的Servlet的url-pattern
			data : {},
			dataType:"json",
			success : function(result) {
				
				left1(result);
			},	
			error : function(errorMsg) {
				alert("加载数据失败");
			}
		});//AJAX
	}//loadData()
	function left1(result){
		console.log(result);
		$.getJSON('echarts/map.json', function(data){
		 	$.each(data, function (infoIndex, info){
		     	var city = info.children;
		 		for(var i =0;i<city.length;i++){
					var citydetail = new Array();
		 			var name = city[i].name;
		 			geoCoordMap[name]= citydetail;
		 			var lat = parseFloat(city[i].lat);
		 			var log = parseFloat(city[i].log);
		 			citydetail.push(log);
		 			citydetail.push(lat);
		 		}
		      }) 
		     map_1_option.series[0].data = convertData(data2.sort(function (a, b) {
		                return b.value - a.value;
		            })),
		/*            }).slice(0, 6)),
		*/     map_1.setOption(map_1_option);
		});
		var geoCoordMap = {
				
		};

		var data2 = result;
//		var data2 =  [						
//						    {name: '商丘', value: 9},
//						    {name: '鄂尔多斯', value: 12},
//						    {name: '招远', value: 12},
//						    {name: '舟山', value: 12},
//						    {name: '齐齐哈尔', value: 14},
//						    {name: '盐城', value: 15},
//						    {name: '赤峰', value: 16},
//						    {name: '青岛', value: 18},
//						    {name: '乳山', value: 18},
//						    {name: '金昌', value: 19},
//						    {name: '泉州', value: 21},
//						    {name: '莱西', value: 21},
//						    {name: '日照', value: 21},
//						    {name: '胶南', value: 22},
//						    {name: '南通', value: 23},
//						    {name: '拉萨', value: 24},
//						    {name: '云浮', value: 24},
//						    {name: '梅州', value: 25},
//						    {name: '文登', value: 25},
//						    {name: '上海', value: 25},
//						    {name: '攀枝花', value: 25},
//						    {name: '威海', value: 25},
//						    {name: '承德', value: 25},
//						    {name: '厦门', value: 26},
//						    {name: '汕尾', value: 26},
//						    {name: '潮州', value: 26},
//						    {name: '丹东', value: 27},
//						    {name: '太仓', value: 27},
//						    {name: '曲靖', value: 27},
//						    {name: '烟台', value: 28},
//						    {name: '福州', value: 29},
//						    {name: '瓦房店', value: 30},
//						    {name: '即墨', value: 30},
//						    {name: '抚顺', value: 31},
//						    {name: '玉溪', value: 31},
//						    {name: '张家口', value: 31},
//						    {name: '阳泉', value: 31},
//						    {name: '莱州', value: 32},
//						    {name: '湖州', value: 32},
//						    {name: '汕头', value: 32},
//						    {name: '昆山', value: 33},
//						    {name: '宁波', value: 33},
//						    {name: '湛江', value: 33},
//						    {name: '揭阳', value: 34},
//						    {name: '荣成', value: 34},
//						    {name: '连云港', value: 35},
//						    {name: '葫芦岛', value: 35},
//						    {name: '常熟', value: 36},
//						    {name: '东莞', value: 36},
//						    {name: '河源', value: 36},
//						    {name: '淮安', value: 36},
//						    {name: '泰州', value: 36},
//						    {name: '南宁', value: 37},
//						    {name: '营口', value: 37},
//						    {name: '惠州', value: 37},
//						    {name: '江阴', value: 37},
//						    {name: '蓬莱', value: 37},
//						    {name: '韶关', value: 38},
//						    {name: '嘉峪关', value: 38},
//						    {name: '广州', value: 38},
//						    {name: '延安', value: 38},
//						    {name: '太原', value: 39},
//						    {name: '清远', value: 39},
//						    {name: '中山', value: 39},
//						    {name: '昆明', value: 39},
//						    {name: '寿光', value: 40},
//						    {name: '盘锦', value: 40},
//						    {name: '长治', value: 41},
//						    {name: '深圳', value: 41},
//						    {name: '珠海', value: 42},
//						    {name: '宿迁', value: 43},
//						    {name: '咸阳', value: 43},
//						    {name: '铜川', value: 44},
//						    {name: '平度', value: 44},
//						    {name: '佛山', value: 44},
//						    {name: '海口', value: 44},
//						    {name: '江门', value: 45},
//						    {name: '章丘', value: 45},
//						    {name: '肇庆', value: 46},
//						    {name: '大连', value: 47},
//						    {name: '临汾', value: 47},
//						    {name: '吴江', value: 47},
//						    {name: '石嘴山', value: 49},
//						    {name: '沈阳', value: 50},
//						    {name: '苏州', value: 50},
//						    {name: '茂名', value: 50},
//						    {name: '嘉兴', value: 51},
//						    {name: '长春', value: 51},
//						    {name: '胶州', value: 52},
//						    {name: '银川', value: 52},
//						    {name: '张家港', value: 52},
//						    {name: '三门峡', value: 53},
//						    {name: '锦州', value: 54},
//						    {name: '南昌', value: 54},
//						    {name: '柳州', value: 54},
//						    {name: '三亚', value: 54},
//						    {name: '自贡', value: 56},
//						    {name: '吉林', value: 56},
//						    {name: '阳江', value: 57},
//						    {name: '泸州', value: 57},
//						    {name: '西宁', value: 57},
//						    {name: '宜宾', value: 58},
//						    {name: '呼和浩特', value: 58},
//						    {name: '成都', value: 58},
//						    {name: '大同', value: 58},
//						    {name: '镇江', value: 59},
//						    {name: '桂林', value: 59},
//						    {name: '张家界', value: 59},
//						    {name: '宜兴', value: 59},
//						    {name: '北海', value: 60},
//						    {name: '西安', value: 61},
//						    {name: '金坛', value: 62},
//						    {name: '东营', value: 62},
//						    {name: '牡丹江', value: 63},
//						    {name: '遵义', value: 63},
//						    {name: '绍兴', value: 63},
//						    {name: '扬州', value: 64},
//						    {name: '常州', value: 64},
//						    {name: '潍坊', value: 65},
//						    {name: '重庆', value: 66},
//						    {name: '台州', value: 67},
//						    {name: '南京', value: 67},
//						    {name: '滨州', value: 70},
//						    {name: '贵阳', value: 71},
//						    {name: '无锡', value: 71},
//						    {name: '本溪', value: 71},
//						    {name: '克拉玛依', value: 72},
//						    {name: '渭南', value: 72},
//						    {name: '马鞍山', value: 72},
//						    {name: '宝鸡', value: 72},
//						    {name: '焦作', value: 75},
//						    {name: '句容', value: 75},
//						    {name: '北京', value: 79},
//						    {name: '徐州', value: 79},
//						    {name: '衡水', value: 80},
//						    {name: '包头', value: 80},
//						    {name: '绵阳', value: 80},
//						    {name: '乌鲁木齐', value: 84},
//						    {name: '枣庄', value: 84},
//						    {name: '杭州', value: 84},
//						    {name: '淄博', value: 85},
//						    {name: '鞍山', value: 86},
//						    {name: '溧阳', value: 86},
//						    {name: '库尔勒', value: 86},
//						    {name: '安阳', value: 90},
//						    {name: '开封', value: 90},
//						    {name: '济南', value: 92},
//						    {name: '德阳', value: 93},
//						    {name: '温州', value: 95},
//						    {name: '九江', value: 96},
//						    {name: '邯郸', value: 98},
//						    {name: '临安', value: 99},
//						    {name: '兰州', value: 99},
//						    {name: '沧州', value: 100},
//						    {name: '临沂', value: 103},
//						    {name: '南充', value: 104},
//						    {name: '天津', value: 105},
//						    {name: '富阳', value: 106},
//						    {name: '泰安', value: 112},
//						    {name: '诸暨', value: 112},
//						    {name: '郑州', value: 113},
//						    {name: '哈尔滨', value: 114},
//						    {name: '聊城', value: 116},
//						    {name: '芜湖', value: 117},
//						    {name: '唐山', value: 119},
//						    {name: '平顶山', value: 119},
//						    {name: '邢台', value: 119},
//						    {name: '德州', value: 120},
//						    {name: '济宁', value: 120},
//						    {name: '荆州', value: 127},
//						    {name: '宜昌', value: 130},
//						    {name: '义乌', value: 132},
//						    {name: '丽水', value: 133},
//						    {name: '洛阳', value: 134},
//						    {name: '秦皇岛', value: 136},
//						    {name: '株洲', value: 143},
//						    {name: '石家庄', value: 147},
//						    {name: '莱芜', value: 148},
//						    {name: '常德', value: 152},
//						    {name: '保定', value: 153},
//						    {name: '湘潭', value: 154},
//						    {name: '金华', value: 157},
//						    {name: '岳阳', value: 169},
//						    {name: '长沙', value: 175},
//						    {name: '衢州', value: 177},
//						    {name: '廊坊', value: 193},
//						    {name: '菏泽', value: 184},
//						    {name: '合肥', value: 209},
//						    {name: '武汉', value: 203},
//						    {name: '大庆', value: 200}
//		];
		var convertData = function (data) {
		    var res = [];
		    for (var i = 0; i < data.length; i++) {
		        var geoCoord = geoCoordMap[data[i].name];
		        if (geoCoord) {
		            res.push({
		                name: data[i].name,
		                value: geoCoord.concat(data[i].value)
		            });
		        }
		    }
		    return res;
		};
		//地图容器
		var map_1 = echarts.init(document.getElementById('map_1'));
		//地图容器
		//34个省、市、自治区的名字拼音映射数组


		//网络零售当期分布
		var map_1_option = {

		/*    title: {
		        text: '全国主要城市空气质量',
		        subtext: 'data from PM25.in',
		        left: 'center',
		        textStyle: {
		            color: '#fff'
		        }
		    },*/
		    tooltip : {
		        trigger: 'item'
		    },
		    visualMap: [{
	               type: 'continuous',
	               seriesIndex: 0,
	               text: ['高'],
	               calculable: true,
	               max: 200,
	               inRange: {
	                   color: ['#87aa66', '#ff9224', '#ff0000']
	               }
	            }], 
		/*    legend: {
		        orient: 'vertical',
		        y: 'bottom',
		        x:'right',
		        data:['pm2.5'],
		        textStyle: {
		            color: '#fff'
		        }
		    },*/
		    geo: {
		        map: 'china',
		        label: {
		            emphasis: {
		                show: false
		            }
		        },
		        roam: true,
		        itemStyle: {
		            normal: {
		                areaColor: 'rgba(255,255,255,0.5)',
		                borderColor: '#111',
		            },
		            emphasis: {
		                areaColor: '#191970'
		            }
		        }
		    },

		    series : [
		/*      {
		            name: 'pm2.5',
		            type: 'scatter',
		            coordinateSystem: 'geo',
		            data: convertData(data2),
		            symbolSize: function (val) {
		                return val[2] / 10;
		            },
		            label: {
		                normal: {
		                    formatter: '{b}',
		                    position: 'right',
		                    show: false
		                },
		                emphasis: {
		                    show: true
		                }
		            },
		            itemStyle: {
		                normal: {
		                    color: '#f75749'
		                }
		            }
		        },*/
		        {
		            name: 'Top 5',
		            type: 'effectScatter',
		            coordinateSystem: 'geo',
		            symbolSize: function (val) {
		                return val[2] / 10;
		            },
		            showEffectOn: 'render',
		            rippleEffect: {
		                brushType: 'stroke'
		            },
		            hoverAnimation: true,
		/*            label: {
		                normal: {
		                    formatter: '{b}',
		                    position: 'right',
		                    show: true,
		                    color:'#333'
		                },
		                emphasis:{
		                	color:'#333'
		                }
		            },*/
		            itemStyle: {
		                normal: {
		                    color: '#f75749',
		                    shadowBlur: 10,
		                    shadowColor: '#333'
		                }
		            },
		            zlevel: 1
		        }
		    ]
		    };
	}

	function bottomleft() {
		var myChart = echarts.init(document.getElementById('bottomleft'));
		var table = "img/server.png";

		var travltable = "img/change.png";

		var unify = "img/cloud.png";

		var retail = "img/application.png";

		var allData = {
			"citys": [{
					"name": "host_1",
					"value": [30.46607, 75.093863, 4],
					symbol: 'image://' + retail,
					"symbolSize": 2,
					"itemStyle": {
						"normal": {
							"color": "#fff"
						}
					}
				},
				{
					"name": "host_2",
					"value": [30.46607, 150.093863],
					symbol: 'image://' + retail,
					"symbolSize": 2,
					"itemStyle": {
						"normal": {
							"color": "#fff"
						}
					}
				},
				{
					"name": "host_3",
					"value": [30.46607, 225.093863],
					symbol: 'image://' + retail,
					"symbolSize": 2,
					"itemStyle": {
						"normal": {
							"color": "#fff"
						}
					}
				},
				{
					"name": "MQ",
					"value": [120.8361, 150.093863],
					"symbolSize": 2,
					"itemStyle": {
						"normal": {
							"color": "#fff"
						}
					}
				},
				{
					"name": "MQ_1",
					"value": [210.0961, 70.143863],
					symbol: 'image://' + table,
					"symbolSize": 2,
					"itemStyle": {
						"normal": {
							"color": "#fff"
						}
					}
				},
				{
					"name": "MQ_2",
					"value": [210.0961, 130.843863],
					symbol: 'image://' + table,
					"symbolSize": 2,
					"itemStyle": {
						"normal": {
							"color": "#fff"
						}
					}
				},
				{
					"name": "MQ_3",
					"value": [210.0961, 190.943863],
					symbol: 'image://' + table,
					"symbolSize": 2,
					"itemStyle": {
						"normal": {
							"color": "#fff"
						}
					}
				},
				{
					"name": "MQ_4",
					"value": [210.0961, 250.243863],
					symbol: 'image://' + table,
					"symbolSize": 2,
					"itemStyle": {
						"normal": {
							"color": "#fff"
						}
					}
				},
				{
					"name": "MQ_5",
					"value": [300.0961, 100.043863],
					symbol: 'image://' + table,
					"symbolSize": 2,
					"itemStyle": {
						"normal": {
							"color": "#fff"
						}
					}
				},
				{
					"name": "MQ_6",
					"value": [300.0961, 220.343863],
					symbol: 'image://' + table,
					"symbolSize": 2,
					"itemStyle": {
						"normal": {
							"color": "#fff"
						}
					}
				},
				{
					"name": "SQLServer_1",
					"value": [400.65607, 100.043863],
					symbol: 'image://' + travltable,
					"symbolSize": 2,
					"itemStyle": {
						"normal": {
							"color": "#fff"
						}
					}
				},
				{
					"name": "SQLServer_2",
					"value": [400.65607, 220.343863],
					symbol: 'image://' + travltable,
					"symbolSize": 2,
					"itemStyle": {
						"normal": {
							"color": "#fff"
						}
					}
				},
				{
					"name": "SQLServer_3",
					"value": [500.65607, 75.143863],
					symbol: 'image://' + travltable,
					"symbolSize": 2,
					"itemStyle": {
						"normal": {
							"color": "#fff"
						}
					}
				},
				{
					"name": "SQLServer_4",
					"value": [500.65607, 150.143863],
					symbol: 'image://' + travltable,
					"symbolSize": 2,
					"itemStyle": {
						"normal": {
							"color": "#fff"
						}
					}
				},
				{
					"name": "ThirdServer",
					"value": [500.4361, 225.093863],
					symbol: 'image://' + unify,
					"symbolSize": 2,
					"itemStyle": {
						"normal": {
							"color": "#fff"
						}
					}
				},
			],

			"moveLines": [{
					"fromName": "host_1",
					"toName": "MQ",
					"coords": [
						[30.46607, 75.093863],
						[120.8361, 150.093863]
					]
				},
				{
					"fromName": "host_2",
					"toName": "MQ",
					"coords": [
						[30.46607, 150.093863],
						[120.8361, 150.093863]
					]
				},
				{
					"fromName": "host_3",
					"toName": "MQ",
					"coords": [
						[30.46607, 225.093863],
						[120.8361, 150.093863]
					]
				},
				{
					"fromName": "MQ",
					"toName": "MQ_1",
					"coords": [
						[120.8361, 150.093863],
						[210.0961, 70.143863]
					]
				},
				{
					"fromName": "MQ",
					"toName": "MQ_2",
					"coords": [
						[120.8361, 150.093863],
						[210.0961, 130.843863]
					]
				},
				{
					"fromName": "MQ",
					"toName": "MQ_3",
					"coords": [
						[120.8361, 150.093863],
						[210.0961, 190.943863]
					]
				},
				{
					"fromName": "MQ",
					"toName": "MQ_4",
					"coords": [
						[120.8361, 150.093863],
						[210.0961, 250.243863]
					]
				},
				{
					"fromName": "MQ_1",
					"toName": "SQLServer_2",
					"coords": [
						[210.0961, 70.143863],
						[400.65607, 220.343863]
					]
				},
				{
					"fromName": "MQ_1",
					"toName": "SQLServer_3",
					"coords": [
						[210.0961, 70.143863],
						[500.65607, 75.143863]
					]
				},
				{
					"fromName": "MQ_1",
					"toName": "SQLServer_4",
					"coords": [
						[210.0961, 70.143863],
						[500.65607, 150.143863]
					]
				},
				{
					"fromName": "MQ_2",
					"toName": "MQ_5",
					"coords": [
						[210.0961, 130.843863],
						[300.0961, 100.043863]
					]
				},
				{
					"fromName": "MQ_3",
					"toName": "MQ_6",
					"coords": [
						[210.0961, 190.943863],
						[300.0961, 220.343863]
					]
				},
				{
					"fromName": "MQ_4",
					"toName": "SQLServer_4",
					"coords": [
						[210.0961, 250.243863],
						[500.65607, 150.143863]
					]
				},
				{
					"fromName": "MQ_5",
					"toName": "SQLServer_1",
					"coords": [
						[300.0961, 100.043863],
						[400.65607, 100.043863]
					]
				},
				{
					"fromName": "MQ_6",
					"toName": "thirdserver",
					"coords": [
						[300.0961, 220.343863],
						[500.4361, 225.093863]
					]
				},

			]
		};
		option = {

			title: {
				text: '服务可用性监控',
				left: '22',
				textStyle: {
					color: '#fff'
				}
			},
			legend: {
				show: false,
				orient: 'vertical',
				top: 'bottom',
				left: 'right',
				data: ['地点', '线路'],
				textStyle: {
					color: '#fff'
				}
			},
			tooltip: {
				formatter: '{b}'
			},
			geo: {
				map: '北京',
				label: {
					emphasis: {
						show: false
					}
				},
				roam: true,
				itemStyle: {
					normal: {
						areaColor: '#blue',
						borderColor: '#blue'
					},
					emphasis: {
						areaColor: 'blue'
					}
				}
			},
			series: [{
				name: '地点',
				type: 'effectScatter',
				coordinateSystem: 'geo',
				zlevel: 2,
				rippleEffect: {
					brushType: 'stroke',
					period: 7,
					scale: 26,
					areaStyle: {
						color: 'blue',
					},
				},
				label: {
					normal: {
						show: true,
						position: 'bottom',
						//bottom:'bottom',
						formatter: '{b}'
					},
					emphasis: {
						show: true,
						position: 'right',
						formatter: '{b}'
					}
				},
				symbolSize: 2,
				showEffectOn: 'render',
				itemStyle: {
					normal: {
						color: 'blue'
					}
				},
				data: allData.citys
			}, {
				name: '线路',
				type: 'lines',
				coordinateSystem: 'geo',
				zlevel: 2,
				large: true,
				effect: {
					show: true,
					period: 6,
					trailLength: 0.1,
					constantSpeed: 30,
					symbol: 'arrow', //ECharts 提供的标记类型包括 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow'
					symbolSize: 6,
					//trailLength: 0,
				},
				lineStyle: {
					normal: {
						color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
							offset: 0,
							//color: '#58B3CC'
							color: 'rgba(255,255,255,0.3)'
						}, {
							offset: 1,
							color: 'rgba(255,255,255,0.3)'
							//color:'green'
						}], false),
						width: 1,
						opacity: 0.6,
						curveness: 0.05
					}
				},
				data: allData.moveLines
			}]
		};
		myChart.setOption(option);
	}

	function load_right1(){
		$.ajax({
			type : 'post',	//传输类型	
			async : false,	//同步执行
			url : 'avg_yongdianliang.do',	//web.xml中注册的Servlet的url-pattern
			data : {},
			dataType:"json",
			success : function(result) {
				
				right1(result);
			},	
			error : function(errorMsg) {
				alert("加载数据失败");
			}
		});//AJAX
	}//loadData()
	function right1(result) {
		aaaa = result;
		var myChart = echarts.init(document.getElementById('right1'));
		var option = {
			legend: {
				//data: ['邮件', '营销', '联盟', '广告', '视频', '直接', '访问', '搜索'],
				data:aaaa[0].yingyong,
				padding: 11,
				textStyle: {
					color: '#fff',
				},
			},
			grid: {
				left: '3%',
				right: '4%',
				bottom: '3%',
				containLabel: true
			},

			xAxis: {
				type: 'category',
				boundaryGap: false,
				//data: ['一', '二', '三', '四', '五', '六', '日', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14'],
				data:aaaa[0].date,
				axisLabel: {
					textStyle: {
						color: '#fff'
					}
				},
			},
			yAxis: {
				type: 'value',
				axisLabel: {
					textStyle: {
						color: '#fff'
					}
				},
			},
			series: [{
					name: '邮件',
					type: 'line',
					stack: '总量',
					//data: [120, 132, 101, 134, 90, 230, 210, 120, 132, 101, 134, 90, 230, 210, 120, 132, 101, 134, 90, 230, 210],
					data:aaaa[0].youjian,
					areaStyle: {}
				},
				{
					name: '营销',
					type: 'line',
					stack: '总量',
					//data: [220, 182, 191, 234, 290, 330, 310, 220, 182, 191, 234, 290, 330, 310, 220, 182, 191, 234, 290, 330, 310],
					data:aaaa[0].yingxiao,
					areaStyle: {}
				},
				{
					name: '联盟',
					type: 'line',
					stack: '总量',
					//data: [150, 232, 201, 154, 190, 330, 410, 150, 232, 201, 154, 190, 330, 410, 150, 232, 201, 154, 190, 330, 410],
					data:aaaa[0].lianmeng,
					areaStyle: {}
				},
				{
					name: '广告',
					type: 'line',
					stack: '总量',
					//data: [320, 332, 301, 334, 390, 330, 320, 320, 332, 301, 334, 390, 330, 320, 320, 332, 301, 334, 390, 330, 320],
					data:aaaa[0].guanggao,
					areaStyle: {}
				},
				{
					name: '视频',
					type: 'line',
					stack: '总量',
					//data: [820, 932, 901, 934, 1290, 1330, 1320, 820, 932, 901, 934, 1290, 1330, 1320, 820, 932, 901, 934, 1290, 1330, 1320],
					data:aaaa[0].shipin,
					areaStyle: {}
				},
				{
					name: '直接',
					type: 'line',
					stack: '总量',
					//data: [830, 900, 934, 500, 1330, 1320, 820, 932, 901, 934, 1290, 1330, 1320, 820, 932, 901, 934, 1290, 1330, 1320],
					data:aaaa[0].zhijie,
					areaStyle: {}
				},
				{
					name: '访问',
					type: 'line',
					stack: '总量',
					//data: [120, 132, 101, 134, 90, 230, 210, 120, 132, 101, 134, 90, 230, 210, 120, 132, 101, 134, 90, 230, 210],
					data:aaaa[0].fangwen,
					areaStyle: {}
				},
				{
					name: '搜索',
					type: 'line',
					stack: '总量',
					//data: [200, 202, 101, 134, 90, 230, 210, 200, 202, 101, 134, 90, 230, 210, 200, 202, 101, 134, 90, 230, 210],
					data:aaaa[0].sousuo,
					areaStyle: {}
				}
			]
		};
		myChart.clear();
		myChart.setOption(option);
	}

	function load_right2(){
		$.ajax({
			type : 'post',	//传输类型	
			async : false,	//同步执行
			url : 'shujuliu.do',	//web.xml中注册的Servlet的url-pattern
			data : {},
			dataType:"json",
			success : function(result) {
				
				right2(result);
			},	
			error : function(errorMsg) {
				alert("加载数据失败");
			}
		});//AJAX
	}//loadData()
	function right2(result) {
		var myChart = echarts.init(document.getElementById('right2'));
		var option = {
			title: {
				text: '数据流监控',
				left: 20,
				textStyle: {
					color: '#fff',
				},
			},
			xAxis: {
				type: 'category',
				boundaryGap: false,
				//data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
				data:result[0].date,
				axisLabel: {
					textStyle: {
						color: '#fff'
					}
				},
			},
			yAxis: {
				type: 'value',
				axisLabel: {
					textStyle: {
						color: '#fff'
					}
				},
			},
			series: [{
					//data: [820, 790, 700, 650, 650, 700, 800],
					data:result[0].dataMax,
					type: 'line',
					smooth: true,
					lineStyle: {
						color: '#66CCCC'
					},
					areaStyle: {
						color: '#66CC66'
					}
				},
				{
					//data: [20, 22, 17, 19, 25, 27, 26],
					data:result[0].dataMin,
					type: 'line',
					smooth: true,
					areaStyle: {
						color: '#fff'
					}
				}
			]
		};
		myChart.clear();
		myChart.setOption(option);
	}

	function load_right3(){
		$.ajax({
			type : 'post',	//传输类型	
			async : false,	//同步执行
			url : 'yonghuliang.do',	//web.xml中注册的Servlet的url-pattern
			data : {},
			dataType:"json",
			success : function(result) {
				
				right3(result);
			},	
			error : function(errorMsg) {
				alert("加载数据失败");
			}
		});//AJAX
	}//loadData()
	function right3(result) {
		var myChart = echarts.init(document.getElementById('right3'));
		var option = {
			title: {
				text: '用户量统计',
				left: 20,
				textStyle: {
					color: '#fff',
				},
			},

			legend: {
				data: ['用户'],
				padding: 35,
				textStyle: {
					color: '#fff'
				},
			},
			xAxis: {
				type: 'category',
				boundaryGap: false,
				//data: ['一', '二', '三', '四', '五', '六', '日', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14'],
				data:result[0].date,
				axisLabel: {
					textStyle: {
						color: '#fff'
					}
				},
			},
			yAxis: {
				type: 'value',
				axisLabel: {
					textStyle: {
						color: '#fff'
					}
				},
			},
			series: [{
				name: '用户',
				type: 'line',
				stack: '总量',
				//data: [120, 132, 101, 134, 90, 230, 210, 120, 132, 101, 134, 90, 230, 210, 120, 132, 101, 134, 90, 230, 210],
				data:result[0].users,
				lineStyle: {
					color: '#0000FF'
				},
				areaStyle: {
					color: '#0000FF'
				}
			}, ]
		};

		myChart.clear();
		myChart.setOption(option);
	}

	function load_right4(){
		$.ajax({
			type : 'post',	//传输类型	
			async : false,	//同步执行
			url : 'dianliang.do',	//web.xml中注册的Servlet的url-pattern
			data : {},
			dataType:"json",
			success : function(result) {
				
				right4(result);
			},	
			error : function(errorMsg) {
				alert("加载数据失败");
			}
		});//AJAX
	}//loadData()
	function right4(result) {
		var myChart = echarts.init(document.getElementById('right4'));
		//var xData = ['8:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00'];
		//var yData = [80, 87, 51, 81, 23, 45, 33, 60];
		var xData = result[0].time;
		var yData = result[0].electricity;
		var option = {
			color: ['#3398DB'],
			tooltip: {
				trigger: 'axis',
				axisPointer: {
					type: 'line',
					lineStyle: {
						opacity: 0
					}
				},
				formatter: function(prams) {
					return "办理数：" + prams[0].data
				}
			},

			grid: {
				left: '0%',
				right: '0%',
				bottom: '5%',
				top: '7%',
				height: '85%',
				containLabel: true,
				z: 22
			},
			xAxis: [{
				type: 'category',
				gridIndex: 0,
				data: xData,
				axisTick: {
					alignWithLabel: true
				},
				axisLine: {
					interval: 0,
					show: false,
					lineStyle: {
						color: '#0c3b71'
					}
				},
				axisLabel: {
					show: true,
					color: '#fff',
					fontSize: 14
				}
			}],
			yAxis: [{
					type: 'value',
					gridIndex: 0,
					splitLine: {
						show: false
					},
					axisTick: {
						show: false
					},
					axisLine: {
						show: false
					},
					axisLabel: {
						color: 'rgb(170,170,170)',
						formatter: ''
					}
				},
				{
					type: 'value',
					gridIndex: 0,
					splitNumber: 12,
					splitLine: {
						show: false
					},
					axisLine: {
						show: false
					},
					axisTick: {
						show: false
					},
					axisLabel: {
						show: false
					},
					splitArea: {
						show: false,

					}
				}
			],
			series: [{
					name: '办理数',
					type: 'bar',
					barWidth: '40%',
					xAxisIndex: 0,
					yAxisIndex: 0,
					label: {
						normal: {
							show: true,
							position: "top",
							textStyle: {
								color: "#ffc72b",
								fontSize: 20
							}
						}
					},
					itemStyle: {
						normal: {
							color: new echarts.graphic.LinearGradient(
								0, 0, 0, 1, [{
										offset: 0,
										color: '#ffff37'
									},
									{
										offset: 0.5,
										color: '#ffd306'
									},
									{
										offset: 1,
										color: '#ff9224'
									}
								]
							)
						}
					},
					data: yData,
					zlevel: 11

				},
				{
					name: '背景',
					type: 'bar',
					barWidth: '70%',
					xAxisIndex: 0,
					yAxisIndex: 1,
					barGap: '-135%',
					data: [100, 100, 100, 100, 100, 100, 100, 100],
					itemStyle: {
						normal: {
							color: 'rgba(255,255,255,0.1)'
						}
					},
					zlevel: 9
				},

			]
		};
		myChart.clear();
		myChart.setOption(option);
	}
	
	function load_middle2(){
		$.ajax({
			type : 'post',	//传输类型	
			async : false,	//同步执行
			url : 'shujufenxi.do',	//web.xml中注册的Servlet的url-pattern
			data : {},
			dataType:"json",
			success : function(result) {
				
				middle2(result);
			},	
			error : function(errorMsg) {
				alert("加载数据失败");
			}
		});//AJAX
	}//loadData()
	
	function middle2(result) {
		var myChart = echarts.init(document.getElementById('middle2'));
		//var dataAll = [389, 259, 262, 324, 232, 176];
		//var yAxisData = ['原因1', '原因2', '原因3', '原因4', '原因5', '原因6'];
		var dataAll = result[0].data;
		var yAxisData = result[0].reason;
		var option = {

			title: [

			],
			grid: [{
				x: '16%',
				y: '7%',
				width: '60%',
				height: '90%',

			}, ],
			tooltip: {
				formatter: '{b} ({c})'
			},
			xAxis: [{
				gridIndex: 0,
				axisTick: {
					show: false
				},
				axisLabel: {
					show: false
				},
				splitLine: {
					show: false
				},
				axisLine: {
					show: false
				}
			}, ],
			yAxis: [{
				gridIndex: 0,
				interval: 0,
				data: yAxisData.reverse(),
				axisTick: {
					show: false
				},
				axisLabel: {
					show: true
				},
				splitLine: {
					show: false
				},
				axisLine: {
					show: true,
					lineStyle: {
						color: "#fff"
					}
				},
			}],
			series: [

				{
					
					type: 'bar',
					xAxisIndex: 0,
					yAxisIndex: 0,
					barWidth: '45%',
					itemStyle: {
						normal: {
							color: '#86c9f4'
						}
					},
					label: {
						normal: {
							show: true,
							position: "right",
							textStyle: {
								color: "#fff"
							}
						}
					},
					data: dataAll.sort(),
				},

			]
		};
		myChart.clear();
		myChart.setOption(option);
	}

});